package fr.greta.centre.metier;


import java.sql.Timestamp;

public class Connexion {
	private int idConnexion;
	private Candidat candidat;
	private Timestamp debutConnexion;
	private Timestamp finConnexion;
	private String ipConnexion;
	private String userAgent;
	public Connexion() {

	}
	public Connexion(int idConnexion, Candidat candidat,
			Timestamp debutConnexion, Timestamp finConnexion,
			String ipConnexion, String userAgent) {
		this.idConnexion = idConnexion;
		this.candidat = candidat;
		this.debutConnexion = debutConnexion;
		this.finConnexion = finConnexion;
		this.ipConnexion = ipConnexion;
		this.userAgent = userAgent;
	}
	public int getIdConnexion() {
		return idConnexion;
	}
	public void setIdConnexion(int idConnexion) {
		this.idConnexion = idConnexion;
	}
	public Candidat getCandidat() {
		return candidat;
	}
	public void setCandidat(Candidat candidat) {
		this.candidat = candidat;
	}
	public Timestamp getDebutConnexion() {
		return debutConnexion;
	}
	public void setDebutConnexion(Timestamp debutConnexion) {
		this.debutConnexion = debutConnexion;
	}
	public Timestamp getFinConnexion() {
		return finConnexion;
	}
	public void setFinConnexion(Timestamp finConnexion) {
		this.finConnexion = finConnexion;
	}
	public String getIpConnexion() {
		return ipConnexion;
	}
	public void setIpConnexion(String ipConnexion) {
		this.ipConnexion = ipConnexion;
	}
	public String getUserAgent() {
		return userAgent;
	}
	public void setUserAgent(String userAgent) {
		this.userAgent = userAgent;
	}
	@Override
	public int hashCode() {
		final int prime = 31;
		int result = 1;
		result = prime * result
				+ ((candidat == null) ? 0 : candidat.hashCode());
		result = prime * result
				+ ((debutConnexion == null) ? 0 : debutConnexion.hashCode());
		result = prime * result
				+ ((finConnexion == null) ? 0 : finConnexion.hashCode());
		result = prime * result + idConnexion;
		result = prime * result
				+ ((ipConnexion == null) ? 0 : ipConnexion.hashCode());
		result = prime * result
				+ ((userAgent == null) ? 0 : userAgent.hashCode());
		return result;
	}
	@Override
	public boolean equals(Object obj) {
		if (this == obj)
			return true;
		if (obj == null)
			return false;
		if (getClass() != obj.getClass())
			return false;
		Connexion other = (Connexion) obj;
		if (candidat == null) {
			if (other.candidat != null)
				return false;
		} else if (!candidat.equals(other.candidat))
			return false;
		if (debutConnexion == null) {
			if (other.debutConnexion != null)
				return false;
		} else if (!debutConnexion.equals(other.debutConnexion))
			return false;
		if (finConnexion == null) {
			if (other.finConnexion != null)
				return false;
		} else if (!finConnexion.equals(other.finConnexion))
			return false;
		if (idConnexion != other.idConnexion)
			return false;
		if (ipConnexion == null) {
			if (other.ipConnexion != null)
				return false;
		} else if (!ipConnexion.equals(other.ipConnexion))
			return false;
		if (userAgent == null) {
			if (other.userAgent != null)
				return false;
		} else if (!userAgent.equals(other.userAgent))
			return false;
		return true;
	}
	@Override
	public String toString() {
		return "Connexion [idConnexion=" + idConnexion + ", candidat="
				+ candidat + ", debutConnexion=" + debutConnexion
				+ ", finConnexion=" + finConnexion + ", ipConnexion="
				+ ipConnexion + ", userAgent=" + userAgent + "]";
	}

}
